Home/ Projects/ Olist SQL E-Commerce Analysis
Case Study · SQL · PostgreSQL 17 · E-Commerce

Olist SQL
E-Commerce Analysis

A Brazilian e-commerce marketplace wants to understand which sellers and categories drive revenue, and whether delivery performance is costing them customer satisfaction and repeat business.

PostgreSQL 17 10 Business Queries Window Functions View on GitHub
Rated 9.5 / 10
01 · Business Problem

Which sellers drive growth — and is late delivery killing retention?

Olist is a Brazilian e-commerce marketplace connecting small sellers to major retail channels. Leadership needs data-driven answers to two strategic questions: Where is revenue concentrated, and are operational failures (late deliveries) eroding the customer relationships that drive repeat business?

The economic insight: In marketplace businesses, seller concentration risk is a critical strategic issue. If 10% of sellers drive 40%+ of revenue, the platform is vulnerable. Understanding this concentration — and what drives it — is a CFO-level concern, not just an operational metric.
02 · Dataset

Olist Brazilian E-Commerce Dataset

The dataset is a real-world e-commerce database from Olist, containing multiple relational tables covering orders, products, customers, sellers, payments, order items, and reviews. All analysis was conducted in PostgreSQL 17 with pgAdmin 4.

100K+
Orders across the Brazilian marketplace dataset
8
Relational tables joined across the analysis
10
Business queries answering specific strategic questions
9.5
Independent rating out of 10 for query quality and business depth
03 · SQL Techniques Used

Advanced SQL applied to real business questions

01
Top sellers by revenue — with market share
CTE + DENSE_RANK() + SUM() OVER() for percentage of total
02
Delivery delay analysis — actual vs. estimated delivery date
DATEDIFF, CASE WHEN classification, AVG() by category
03
Late delivery vs. review score correlation
JOIN across orders + reviews + order_items, GROUP BY delay bucket
04
Month-over-month revenue growth by product category
LAG() window function for MoM comparison
05
Customer repeat purchase behavior
COUNT DISTINCT orders per customer_id, HAVING clause for repeat buyers
06–10
Payment method analysis, regional concentration, seller performance ranking, category margin proxy, and seasonal demand patterns
Multiple CTEs, subqueries, window functions throughout

Sample query — top sellers by revenue with market share:

-- Top 10 sellers by revenue with cumulative market share
WITH seller_revenue AS (
  SELECT
    oi.seller_id,
    SUM(oi.price) AS total_revenue,
    COUNT(DISTINCT oi.order_id) AS total_orders
  FROM order_items oi
  JOIN orders o ON oi.order_id = o.order_id
  WHERE o.order_status = 'delivered'
  GROUP BY oi.seller_id
)
SELECT
  seller_id,
  total_revenue,
  total_orders,
  DENSE_RANK() OVER (ORDER BY total_revenue DESC) AS revenue_rank,
  ROUND(
    total_revenue * 100.0 / SUM(total_revenue) OVER(), 2
  ) AS market_share_pct
FROM seller_revenue
ORDER BY revenue_rank
LIMIT 10;
04 · Key Findings

What the SQL analysis revealed

Finding 1 — Revenue concentration is high: The top 10 sellers drove 23% of total marketplace revenue despite representing less than 1% of total seller count. This is a concentration risk — losing 2–3 top sellers would have a measurable platform-wide impact.
Finding 2 — Late delivery directly causes 1-star reviews: Orders delivered more than 7 days late averaged a 1.8-star review score vs. 4.3 stars for on-time deliveries. This is not correlation — it's a clean causal signal. Every late order is statistically likely to generate a negative review that damages seller reputation and customer lifetime value.
Finding 3 — Health and Beauty is the highest-growth category: Month-over-month LAG() analysis showed Health and Beauty growing at 18% MoM during peak periods vs. 4% for the overall marketplace. This is a product category worth prioritizing for seller recruitment and logistics investment.
Finding 4 — Credit card dominates but boleto users spend more per order: While 74% of orders used credit card, boleto (bank slip) users had a 23% higher average order value. This payment method preference likely correlates with a higher-income customer segment worth targeting.
05 · Recommendations

Strategic actions from the SQL findings

  • Implement a seller reliability score that weights delivery performance heavily. Use the late delivery vs. review score relationship as the business case — every delivery failure has a quantifiable review impact.
  • Build a top seller retention program focused on the top 50 sellers by revenue. These accounts represent disproportionate platform revenue and should receive account management attention and priority logistics support.
  • Invest in Health and Beauty seller acquisition and logistics capacity. The MoM growth data makes this the clearest category expansion opportunity.
  • Analyze boleto users as a distinct customer segment for premium product merchandising. Their higher average order value suggests different purchasing intent that the platform should capitalize on.

Project Preview

Olist SQL Analysis

Full SQL scripts, query documentation, and results are available on GitHub.

9.5
Independent Rating / 10

SQL Techniques

CTEs Window Functions LAG() DENSE_RANK() SUM() OVER() Multi-table JOINs HAVING Subqueries CASE WHEN PostgreSQL 17

Skills Demonstrated

Advanced SQL Database Design Business Query Writing Delivery Analytics Revenue Analysis Seller Concentration MoM Growth Analysis

Project Links

GitHub Repository

About Carlton Waiti

Data Analyst with Economics & Finance background. Projects rated 9.5–9.8/10. Available for remote roles.

Get In Touch